import React from 'react'
import {BaseNodeWidget} from "../base/BaseNodeWidget"
import {PolygonUtil} from "../../../util/PolygonUtil"

export class ProcessNodeWidget extends BaseNodeWidget {
    static defaultProps = {
        node: null,
        text: "Process",
        width: 100,
        height: 50,
        color: '#63c2de',
        strokeWidth: '1',
    };

    createShape (props) {
        const {node, displayOnly, color: displayColor} = props
        const {name, color} = node
        const style = {}
        if (color || displayColor) {
            style.background = color || displayColor
        }

        const polygonProps = {
            width : props.width,
            height : props.height,
            color : props.color,
            strokeWidth : props.strokeWidth,
            stroke: props.stroke,
        }
        return PolygonUtil.createRoundedRectangle(polygonProps)
    };


}

export const ProcessNodeWidgetFactory = React.createFactory(ProcessNodeWidget)
